|
In mathematics and computer programming, the order of operations (or operator precedence) is a collection of rules that define which procedures to perform first in order to evaluate a given mathematical expression. For example, in mathematics and most computer languages, multiplication precedes addition.〔 Thus, in the expression 2 + 3 × 4, the answer is 14 (not 20). Brackets, ( and ), , or () — which have their own rules — can indicate an alternate order or reinforce the default order to avoid confusion, thus the preceding expression could be changed to (2 + 3) × 4 to produce 20, or 2 + (3 × 4) to produce 14 (the default if there are no brackets). Since the introduction of modern algebraic notation, multiplication has taken precedence over addition.〔 Thus 3 + 4 × 5 = 4 × 5 + 3 = 23. When exponents were first introduced in the 16th and 17th centuries, exponents took precedence over both addition and multiplication and could be placed only as a superscript to the right of their base.〔 Thus 3 + 52 = 28 and 3 × 52 = 75. To change the order of operations, originally a vinculum (an overline or underline) was used. Today, parentheses or brackets are used to explicitly denote precedence by grouping parts of an expression that should be evaluated first. Thus resulting in (2 + 3) × 4 = 20 to force addition to precede multiplication or (3 + 5)2 = 64 to force addition to precede exponentiation. ==Definition== The order of operations used throughout mathematics, science, technology and many computer programming languages is expressed here: : exponents〔 and roots : multiplication〔 and division〔 : addition〔 and subtraction〔 This means that if a mathematical expression is preceded by one binary operator and followed by another, the operator higher on the list should be applied first.〔 The commutative and associative laws of addition and multiplication allow adding terms in any order, and multiplying factors in any order—but mixed operations must obey the standard order of operations. It is helpful to treat division as multiplication by the reciprocal (multiplicative inverse) and subtraction as addition of the opposite (additive inverse). Thus 3/4 = 3 ÷ 4 = 3 • ¼; in other words the quotient of 3 and 4 equals the product of 3 and ¼. Also 3 − 4 = 3 + (−4); in other words the difference of 3 and 4 equals the sum of positive three and negative four. Thus, 1 − 3 + 7 can be thought of as the sum of 1, negative 3, and 7, and add in any order: (1 − 3) + 7 = −2 + 7 = 5 and in reverse order (7 − 3) + 1 = 4 + 1 = 5, always keeping the negative sign with the 3. The root symbol, √, requires a symbol of grouping around the radicand. The usual symbol of grouping is a bar (called vinculum) over the radicand. Other functions use parentheses around the input to avoid ambiguity. The parentheses are sometimes omitted if the input is a monomial. Thus, sin x = sin(x), but sin x + y = sin(x) + y, because x + y is not a monomial. Some calculators and programming languages require parentheses around function inputs, some do not. Stacked exponents are applied from the top down, i.e., from right to left.〔〔()〕 Symbols of grouping can be used to override the usual order of operations.〔 Grouped symbols can be treated as a single expression.〔 Symbols of grouping can be removed using the associative and distributive laws, also they can be removed if the expression inside the symbol of grouping is sufficiently simplified so no ambiguity results from their removal. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「order of operations」の詳細全文を読む スポンサード リンク
|